/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 涛
 * Date: 2023-09-14
 * Time: 18:30
 */
abstract class Animal {
    public String name;
    public int age;

    public abstract void eat();
    public abstract void sleep();

    public double getArea() {
        return area;
    }
    protected double area;
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
}

class Cat extends Animal {
    public void eat() {
        System.out.println(this.name+"正在吃猫粮");
    }
    public void sleep() {
        System.out.println(this.name + "在猫窝睡觉");
    }

    public Cat(String name, int age) {
        super(name, age);
        this.name = name;
        this.age = age;
    }

}

class Dog extends Animal {
    public void eat() {
        System.out.println(this.name+"正在吃狗粮");
    }
    public void sleep() {
        System.out.println(this.name + "在狗窝睡觉");

    }
    public Dog(String name, int age) {
        super(name, age);
        this.name = name;
        this.age = age;
    }
}

public class Test {
    public static void main(String[] args) {
        Animal animal1 = new Cat("咪咪", 15);
        Animal animal2 = new Dog("花花", 10);

        animal1.eat();
        animal2.eat();
        System.out.println("============");
        animal1.sleep();
        animal2.sleep();
    }

}
